﻿using System.ComponentModel.Composition;
using Cubicle.Core.Interfaces;
using Cubicle.Core.Processors;

namespace Cubicle.Excel.Processors
{
    [Export("Cubicle.Excel.Processors.ConditionArray", typeof(IProcessor<object>))]
    [ExportMetadata("Name", "ConditionArray")]
    [ExportMetadata("Description", "Identify arrays for marshalling.")]
    public class ConditionArray : ConditionalQueue<object>
    {

        public override bool Condition(object request)
        {
            var type = request.GetType();
            return type.IsArray
                && type.GetArrayRank() == 1;
        }

    }
}